<%@ page import="javax.print.attribute.standard.MediaSize" %>
<%@ page pageEncoding="UTF-8"%>
<%@ include file="common.jsp"%>
<%
	/**
	 *	验证请求是否合法
	 */
	Message msg = input.validate();
	int errcode = msg.getErrcode();
	if (0 != errcode) {
		Tools.encryptPrint(out, msg);
		return;
	}
	msg.setErrcode(0); // 设置返回信息
	msg.put("data", new ArrayList());
	hospital = input.getInt("hospital", -1); // 医院id
	act = input.getDesc("act", "list"); // 访问类型
	input.setDesc("ip", input.getIp());
	Map<String, String> parameters = input.getParameters(); // 解密后的参数
	String intefaceNames = request.getServletPath();
	String[] servletNames = intefaceNames.split("/");
	String appType = input.getDesc("app_type", "");
	String jspName = "";
	String upJspName = "";
	if (servletNames.length > 2) {
		jspName = servletNames[servletNames.length - 1];
	if (!jspName.endsWith(".jsp"))
		jspName += ".jsp";
		upJspName = servletNames[servletNames.length - 2];
	}
	String filePath = request.getServletContext().getRealPath(appType + "/" + hospital + "/" + upJspName + "/" + jspName);
	File file = new File(filePath);
	if (file.exists() && intefaceNames.startsWith("/v3")) {  // 文件存在
		Map<String, String> params = input.getParameters();
		String _json = JSONUtil.toJson(params);
		_json = Tools.encryptStr(_json);
		input.setDesc("json", _json);
		input.route("/" + upJspName + "/" + jspName, response, out);
		return;
	}
%>
